﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Brjostagjof.Models.ImageViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Brjóstagjöf - Upplýsingar Um Barn
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" ></script>

    <script type="text/javascript">
        $(document).ready(function () {
            GoToImage(0);
        });

        theImages = new Array();
        if(<%=Model.images.Count() %> ==0){
            theImages[0] = new Image();
            theImages[0].src = '<%= Url.Content( "~/Content/breastfeeding.png")  %>';
        }
        else{
            for (var i = 0; i < <%= Model.images.Count()%>; i++) {
                theImages[i] = new Image();
            }

            var last_pict = <%= Model.images.Count()-1 %> ;

            <%  int i = 0;
                foreach( var img in Model.images ) { %>
                    theImages[<%= i %>].src = '<%= Url.Content( "~/Home/ShowImage/" + img.ID )  %>';
            <%  i++;
            } %>
        }
        </script>
                <script type="text/javascript" src="<%= Url.Content("~/Scripts/JScript2.js")%>"></script>
        <script type="text/javascript">
            var nameSequence = "Keyra";
            var nameStop = "Stop";
        </script>
        
    <h1>Upplýsingar um barn</h1>
    <p><%= Model.child.Name %></p>
    <br />
    <p> Fædd/ur : <%= Model.child.Dateofbirth.ToShortDateString()%> </p>
    <br />
    <ul>
        <li><%: Html.ActionLink("Breyta upplýsingum ", "BreytaBarni", new { id = Model.child.ID })%></li>
        <li><%: Html.ActionLink("Bæta við myndum", "MyndirBarn", new {id = Model.child.ID}) %></li>
    </ul>
    
    <div class="myndAfBarni">
        <table> 
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                    <img src="#" name="animation" height="300" width="400" alt="Myndir"/>
            </td>
        </tr>
    </table>
    </div>
    <table id="mousehover">
        <tr> 
            <td><br />
                <%  int k = 0;
                    foreach(var img in Model.images)
                    { %>
                        <a href ="#" onmouseout="GoToImage('<%= k %>');" onclick="GoToImage('<%= k %>')"><%= img.ImageTitle %></a> <br />
                <%      k++;
                    } %>
            </td>
        </tr>               
    </table>
    <p class= "tilbaka">
        <%: Html.ActionLink("Til Baka", "Bornin") %>
    </p>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="Actions" runat="server" >
    <% Html.RenderPartial("PartialViews/Actions", "MittSvaedi"); %>
</asp:Content>
